#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Date          : 2024/11/6
@File          : test.py
@Author        : liwei68
@Description   : 
"""
nums = [-1, 0, 3, 5, 9, 12]
target = 3




def func(mn, mx):
    mid = int((mn + mx) / 2)
    if nums[mid] == target:
        print(mid)
    elif mid >= mx or mid <= mn:
        print(-1)
    elif nums[mid] < target and mid <= mx:
        return func(mid, mx)
    elif nums[mid] > target and mid >= mn:
        return func(mn, mid)

mn = 0
mx = len(nums)
func(mn, mx)